import 'package:flutter/material.dart';
import 'package:xbaistack/common/global_context.dart';
import 'package:xbaistack/widget/icon_list.dart';
import 'package:xbaistack/widget/input_text.dart';

class TextPage extends StatefulWidget {
  const TextPage({super.key});

  @override
  State<TextPage> createState() => _TextPageState();
}

class _TextPageState extends State<TextPage> {
  String _userName = '测试';
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Text Page')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            InputText(placeholder: "请输入你的账号", showClear: false),
            InputText(password: true, placeholder: "请输入你的密码", showClear: false),
            InputText(placeholder: "请输入你的密码", showClear: true),
            InputText(
              label: "姓名",
              placeholder: "请输入你的账号",
              showClear: false,
              maxLength: 15,
            ),
            InputText(
              label: "用户名",
              icon: Icon(IconFonts.EMPTY),
              placeholder: "请输入你的用户名",
              initialValue: _userName,
              errorText: '',
              onChanged: (value) {
                setState(() {
                  _userName = value;
                });
              },
            ),
            ElevatedButton(
              onPressed: () {
                setState(() {
                  _userName = '修改名字';
                });
              },
              child: Text('修改名字'),
            ),
            InputText(
              label: "用户名",
              icon: Icon(IconFonts.TIP_INFO),
              placeholder: "请输入你的用户名",
              showBorder: true,
              borderRadius: BorderRadius.circular(50),
            ),
          ],
        ),
      ),
    );
  }
}
